home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 098 / cts.asm < prev    next >
Assembly Source File  |  1985-06-03  |  3KB  |  54 lines

  1. ;======================================================================
  2. ;    INT 14H is IBM PC's BIOS Comm I/O Interrupt.  The following is
  3. ;  excerpted from "Assembler for the IBM PC and PC-XT" by Peter Abel.
  4. ;======================================================================
  5. ; Int 14H:  Communications Input/Output.  This operation provides byte
  6. ; stream I/O to the RS232 communications port.  The DX should contain
  7. ; number of the RS232 adapter (0 or 1).  There are four calls established
  8. ; through the AH register.
  9. ; .
  10. ; .
  11. ; .
  12. ; AH = 03:  Return the status of the communications port. The operation
  13. ;           sets the AH with the line control status and sets the AL with
  14. ;           the modem status.
  15. ;    AH = line control status        AL = modem status
  16. ;    7 = Time out                       Recieved line signal detect
  17. ;    6 = Trans dhift register empty     Ring indicator
  18. ;    5 = Trans hold register empty      Data set ready
  19. ;    4 = Break detect                   Clear to send
  20. ;    3 = Framing error                  Delta receive line signal detect
  21. ;    2 = Parity error                   Trailing edge ring detector
  22. ;    1 = Overrun error                  Delta data set ready
  23. ;    0 = Data ready                     Delta clear to send
  24. ;
  25. ;The following ASM code will check the modem for Clear-To-Send
  26. CHECK_COMM:
  27.     MOV   DX,0        ; We're gonna check COM1
  28.         MOV   AH,3           ; Request comm port status
  29.         INT   14H        ; Call to BIOS
  30.         CMP   AL,4        ; Is "Clear To Send" a character
  31.         JE    SEND_CHAR        ; Do it.
  32.         JMP   CHECK_COMM     ; Not yet check it again
  33.                     ; You may want to do somthing else here
  34.                                 ;
  35. SEND_CHAR:             ; Note that option 2 for INT 14H will also
  36.                                 ;   set AL and AH as in option 3 above
  37.     MOV    DX,0        ; Redundant but why not
  38.         MOV    AL,byte ptr [SI] ; Assuming SI points to the byte to send
  39.         MOV    AH,2        ; Request send char
  40.         INT    14H         ; Call to BIOS
  41.         AND    AH,128          ; Bit 7 set if unsuccessfull
  42.         CMP     AH,0          ;
  43.         JE    SEND_ERR    ; Jump to error recovery code
  44.         INC    SI        ; Point to next byte to send
  45.                     ; You'll need to add code here to get out
  46.         CMP     AL,4        ; Is "Clear To Send" a character
  47.         JE      SEND_CHAR    ; Do it.
  48.         JMP     CHECK_COMM     ; Not yet check it again
  49. ;
  50. ;  This is untested, but should work, mjd.
  51.       SEND_CHAR    ; Do it.
  52.         JMP     CHECK_COMM     ; Not yet check it again
  53. ;
  54. ;  This is untested, but should